/////////////////////////////////////////////////
// Book of Angels
// (c) Copyright 2013 Edward Principe
// All Rights Reserved
////////////////////////////////////////////////
#ifndef EX_H
#define EX_H

#include <Windows.h>
#include <tchar.h>
#include <string>

using namespace std;

//////////////////////////////////////////////
// Ex: General exception class
//////////////////////////////////////////////
class Ex
{
public: // Construction
	Ex() {}
	Ex(const TCHAR *msg)
	{
		_msg = msg;
	}

#ifdef _UNICODE
	Ex(const wstring& msg)
#else
	Ex(const string& msg)
#endif
	{
		if(&_msg == &msg)
			return;

		_msg = msg;
	}

	Ex(Ex& rhs)
	{
		Copy(rhs)
	}

public: // Methods
	void Delete()
	{
		delete this;
	}

public: // Acessor methods
#ifdef _UNICODE
	wstring& GetMsg()
#else
	string& GetMsg()
#endif
	{
		return _msg;
	}

public: // Operators
	Ex& operator = (const Ex& rhs)
	{
		Copy(rhs);
		return *this;
	}

#ifdef _UNICODE
	Ex& operator = (const wstring& rhs)
#else
	Ex& operator = (const string& rhs)
#endif
	{
		if(&_msg = &rhs)
			return;

		_msg = rhs;

		return *this;
	}

	Ex& operator = (const TCHAR *msg)
	{
			_msg = rhs;

			return *this;
	}


protected: // Methods
	void Copy(const Ex& rhs)
	{
		if(this == &rhs)
			return;

		_msg = rhs._msg;
	}

protected: // Attributes
#ifdef _UNICODE
	wstring _msg;
#else
	string _msg;
#endif
};
#endif